/**
 * @author:linjiye
 * @date: 2024/01/14
 * @desc: AI原创模块接口定义
 **/

import {createApi} from "@reduxjs/toolkit/query/react";
import useBaseQuery from "@/hooks/useBaseQuery";
import { stringify } from "qs";

export const homeApi = createApi({
  reducerPath:'homeApi',
  baseQuery:useBaseQuery('mm'),
  endpoints(build) {
    return {
      getAccountInfo: build.mutation({
        query(data) {
          return {
            url:'homepage/accountInfo',
            method:"get",
            openErrMessage: true
          }
        },
      })
    }
  }
});

export const homeCommonApi = createApi({
    reducerPath:'homeCommonApi',
    baseQuery:useBaseQuery('common'),
    endpoints(build) {
      return {
        getPosterList: build.mutation({
          query(data) {
            return {
              url:'poster/list?pageNo=1&pageSize=100',
              method:"get",
              openErrMessage: true
            }
          },
        }),
        getToolList: build.mutation({
          query(data) {
            return {
              url:'recommendTool/list?pageNo=1&pageSize=100&platform=2',
              method:"get",
              openErrMessage: true
            }
          },
        }),
        getVideoCaseList: build.mutation({
          query(data) {
            return {
              url:'videoCase/list?pageNo=1&pageSize=100',
              method:"get",
              openErrMessage: true
            }
          },
        }),
        getFeedbackList: build.query({
          query(data) {
            return {
              url:'feedback/admin/list',
              method:"get",
              params: data,
              openErrMessage: true
            }
          },
        }),
      }
    }
});

export const {
  useGetAccountInfoMutation,
} = homeApi;

export const {
  useGetPosterListMutation,
  useGetToolListMutation,
  useGetVideoCaseListMutation,
  useGetFeedbackListQuery,
} = homeCommonApi;
